package com.kingcore.commerce.admin.controller;

//import javax.inject.Inject;
import java.io.Serializable;

import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.kingcore.commerce.base.controller.CommerceController;

@Controller("/admin.indexController")
@RequestMapping("/admin")
public class IndexController extends CommerceController {

	protected static final String Admin_Login_Name = "AdminId";
	// @Inject
	// private User user;

	/**
	 * mod by wzw.
	 * @return
	 */
	@RequestMapping("")
	public String index() {
		Object adminId = getRequest().getSession().getAttribute(Admin_Login_Name);
		if (adminId==null) {
			return "/admin/login";    //fw to main page
		}else{
			return "/admin/index";    //fw to login
		}
	}

	/**
	 * add by wzw.
	 * @return
	 */
	@RequestMapping("/login")
	public String login() {
		
		getRequest().getSession().setAttribute(Admin_Login_Name, "admin");
		return "/admin/index";
	}


	@Override
	protected String getModuleParent() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	protected String getModuleName() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String neww(HttpServletResponse response, Model model)
			throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String edit(HttpServletResponse response, Model model,
			Serializable pk) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String list(HttpServletResponse response, Model model, Object t,
			Integer pageNum, Integer numPerPage) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ModelAndView add(HttpServletResponse response, Model model, Object t)
			throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ModelAndView mod(HttpServletResponse response, Model model, Object t)
			throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ModelAndView remove(HttpServletResponse response, Model model,
			Serializable pk) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

}